const seq = require('sequelize')
const time = require('../time');
module.exports = {
  NAME: 'sys_user',
  TABLE: {
    user_id: {
      type: seq.INTEGER(19),
      primaryKey: true,
      unique: true,
      autoIncrement: true,
      allowNull: false,
      comment: 'user_id 主键，自增',
      field: 'user_id', //  相应的字段名称
    },
    dept_id: {
      type: seq.INTEGER(19),
      allowNull: false,
      comment: '部门ID',
      field: 'dept_id', //  相应的字段名称
    },
    user_name: {
      type: seq.STRING(30),
      comment: '用户账号',
      field: 'user_name',
    },
    user_number: {
      type: seq.STRING(30),
      comment: '用户工号',
      field: 'user_number',
    },
    nick_name: {
      type: seq.STRING(30),
      comment: '用户昵称',
      field: 'nick_name',
    },
    user_type: {
      type: seq.STRING(2),
      comment: '用户类型（00系统用户）',
      field: 'user_type',
      defaultValue: ''
    },
    email: {
      type: seq.STRING(50),
      comment: '用户邮箱',
      field: 'email',
      defaultValue: ''
    },
    phonenumber: {
      type: seq.STRING(11),
      comment: '手机号码',
      field: 'phonenumber',
      defaultValue: ''
    },
    sex:{
      type: seq.CHAR(1),
      defaultValue: 0,
      comment: '用户性别（0男 1女 2未知）',
      field: 'sex',
      defaultValue: '0'
    },
    avatar:{
      type: seq.STRING(100),
      comment: '头像地址',
      field: 'avatar',
      defaultValue: ''
    },
    password:{
      type: seq.STRING(100),
      comment: '密码',
      field: 'password',
      defaultValue: ''
    },
    status:{
      type: seq.CHAR(1),
      comment: '帐号状态（1正常 0停用）',
      field: 'status',
      defaultValue: '1'
    },
    del_flag:{
      type: seq.CHAR(1),
      comment: '删除标志（0代表存在 2代表删除）',
      field: 'del_flag',
      defaultValue: '0'
    },
    login_ip:{
      type: seq.STRING(128),
      comment: '最后登录IP',
      field: 'login_ip',
      defaultValue: ''
    },
    login_date:{
      type: seq.DATE(),
      comment: '最后登录时间',
      field: 'login_date',
    },
    remark:{
      type: seq.STRING(500),
      comment: '备注',
      field: 'remark',
      defaultValue: ''
    },
    ...time.create_date,
    ...time.update_date,
    ...time.create_by,
    ...time.update_by,
  },
}
